-
bulk-create-or-fill-usersBulk Create or Fill Users -
create-or-fill-userCreate or Fill User -
delete-unclaimed-userDelete Unclaimed User -
search-usersSearch Users by Profile Fields -
set-user-rolesSet User Roles -
sync-display-nameSync Display Name -
update-user-profileUpdate User Profile
Bulk Create or Fill Users
Creates or fills many users on the current site in one call, returning counts by action and only what changed for each user. Each entry in users takes the same arguments as create-or-fill-user (email, first_name, last_name, known_as, user_url, nickname, display_name, description, group_id, existing_user, add_to_site, fields) and follows exactly its rules: unclaimed is the only role assigned, an existing user’s site membership is left alone unless add_to_site is true, nothing existing is overwritten, the address is filled as one unit and invalid values are reported per field and never stored. existing_user and add_to_site can be set once for the batch and an entry’s own value wins. dry_run is set once for the batch and defaults to true: set it to false to write. At most 100 entries per call. An entry whose email repeats an earlier one in the batch is not run. One entry failing does not stop the rest: it is counted as error with its code and message. Per entry the result gives index, email, user_id and action, then only filled (field => value, including would_fill in a dry run), rejected and failed (field => reason), site and group when they changed or failed, and display_name_stale when true; skipped fields are left out. Requires promote_users. Pass site_id to act on another site you belong to.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
users |
array of object | Yes | The users to create or fill, each with the same arguments as create-or-fill-user except dry_run. |
|
existing_user |
string | No | "refuse" |
What to do, for every entry that does not set its own existing_user, when the email already belongs to an account: refuse (that entry is an error, nothing changes) or fill_missing. One of: refuse, fill_missing. |
add_to_site |
boolean | No | false |
For every entry that does not set its own add_to_site: true adds an existing user with no role on the current site to it with the unclaimed role. Default false: existing users’ site membership is never changed. New users are always added. |
dry_run |
boolean | No | true |
When true (the default) nothing is written; the result reports what would happen to every entry. |
task_id |
integer | No | Optional. The lh-tasks task this call is working on. Pass with claim_token: the call is refused unless you hold that claim, and a successful call renews it. |
|
claim_token |
string | No | Optional. The claim_token from claim-next-task for task_id. Required when task_id is given. |
|
site_id |
integer | No | Optional. ID of another site in the network to act on; list-my-sites gives the sites you belong to. Permissions are checked on that site. Omit for this site. | |
run_without_site_plugins |
boolean | No | Optional, with site_id. Run the call through this connector even when that site has plugins of its own that cannot be loaded for it. Without this, such a write is refused if it cannot be run on that site itself. |
Create or Fill User
Creates a user on the current site with the unclaimed role, or fills only what an existing account is missing. It takes the legal first and last name, known_as (the first name they go by, if different), email, core user fields (user_url, nickname, display_name, description) and profile fields, and fills an existing account when existing_user is fill_missing and the email (or a registered email alias) already belongs to it. The email is lowercased before lookup and creation. unclaimed is the only role it assigns, and a new user is always added to the current site with it. An existing user’s site membership is left alone unless add_to_site is true: then a user with no account on the current site is added with the unclaimed role, and one with an account but no role on the site is given it. A user who already has a role on the site always keeps it. Never overwrites an existing value, except that a first name, last name, nickname or display name still set to a placeholder (an email address or the login) counts as empty; the address (street_address, town, postcode) is filled as one unit only when all three are empty. user_nicename cannot be set. Invalid values are reported per field and never stored. No membership or group changes for existing users. For an existing user, action is unchanged when nothing was or would be filled and no role was or would be added. When the first or last name of an existing user is filled, display_name_stale says whether the display name no longer uses it; set one with sync-display-name. dry_run defaults to true: set it to false to write. For many users at once, use bulk-create-or-fill-users. Requires promote_users. Pass site_id to act on another site you belong to.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
email |
string | Yes | Email address. Lowercased, then used as the login for a new user, and to find an existing one (including registered email aliases). | |
first_name |
string | No | First name. For an existing user, only filled if currently empty or still a placeholder (an email address or the login). | |
last_name |
string | No | Last name. For an existing user, only filled if currently empty or still a placeholder (an email address or the login). | |
known_as |
string | No | Known as: the first name the person goes by when it is not their legal first name (e.g. Tezzuh), stored in nickname. One first name only, never a full name or email. first_name and last_name stay the legal name. For an existing user, only filled if they have no Known as yet. Cannot be given with nickname. |
|
user_url |
string | No | Website, e.g. a supplier’s site. http or https only; a bare domain such as example.com is given https://. At most 100 characters. For an existing user, only filled if currently empty. | |
nickname |
string | No | Nickname. For an existing user, only filled if currently empty or still a placeholder (an email address or the login). | |
display_name |
string | No | Display name, e.g. a supplier’s trading name. For a new user it replaces the name built from first_name and last_name; for an existing user it is only filled if currently empty or still a placeholder (an email address or the login). At most 250 characters. |
|
description |
string | No | Biographical info. Line breaks are kept and HTML is removed. For an existing user, only filled if currently empty. | |
group_id |
integer | No | Optional BuddyPress group to add a NEW user to. Ignored for existing users. | |
existing_user |
string | No | "refuse" |
What to do when the email already belongs to an account: refuse (return an error, change nothing) or fill_missing. One of: refuse, fill_missing. |
add_to_site |
boolean | No | false |
For an existing user: true adds them to the current site with the unclaimed role when they have no role on it. Default false: an existing user’s site membership is never changed. A new user is always added. |
fields |
object | No | Profile fields. Each is only filled if the user currently has no value for it; the address (street_address, town, postcode) is filled as one unit, only when all three are empty. Invalid values are reported per field and never stored. |
|
dry_run |
boolean | No | true |
When true (the default) nothing is written; the result reports what would happen. |
task_id |
integer | No | Optional. The lh-tasks task this call is working on. Pass with claim_token: the call is refused unless you hold that claim, and a successful call renews it. |
|
claim_token |
string | No | Optional. The claim_token from claim-next-task for task_id. Required when task_id is given. |
|
site_id |
integer | No | Optional. ID of another site in the network to act on; list-my-sites gives the sites you belong to. Permissions are checked on that site. Omit for this site. | |
run_without_site_plugins |
boolean | No | Optional, with site_id. Run the call through this connector even when that site has plugins of its own that cannot be loaded for it. Without this, such a write is refused if it cannot be run on that site itself. |
Delete Unclaimed User
Deletes, network-wide, an account that was created automatically and never claimed, such as one email ingestion made for a spam sender, in two calls: a preview with a confirm_token, then the apply. It is refused unless every check passes: the account has only the unclaimed role on every site; its recorded provenance source is one of lh-messaging, lh-email or lh_crm (accounts from check-ins, group invites and other sources are refused); it is not a super admin or your own account; it has no BuddyPress group memberships, membership requests, friendships or activity, no WooCommerce orders, no posts on any site and no linked phone numbers; and it sent or authored no messages other than ones flagged as spam. Other plugins may add checks. Call first without confirm_token: nothing changes, and the result lists every check, what will be removed and, when all pass, a token valid for about 10 minutes (step refused, with no token, when any fails). Show the result to the user, then call again with the same user_id plus confirm_token; the token works once and is refused if anything about the account changed in between. On apply the user’s spam messages are deleted, messages sent to them are kept but unlinked, pending group invitations to them are removed, and the account is deleted from every site. The deletion is recorded in the audit trail with reason as its note and the task when task_id is given. It cannot be undone. Requires install_plugins.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
user_id |
integer | Yes | The account to delete. | |
reason |
string | No | Optional. Why the account is deleted, e.g. “Spam sender: review-removal sales pitch”. Recorded as the audit trail note. One given with the preview is used if the confirming call has none. | |
confirm_token |
string | No | Optional. The confirm_token from a preview for this user. Omit to preview; pass to apply. |
|
task_id |
integer | No | Optional. The lh-tasks task this call is working on. Pass with claim_token: the call is refused unless you hold that claim, and a successful call renews it. |
|
claim_token |
string | No | Optional. The claim_token from claim-next-task for task_id. Required when task_id is given. |
Search Users by Profile Fields
Searches WordPress users on the current site by user ID and any combination of account and profile fields. The fields are id (exact user IDs; always a restriction on top of the other fields), email (partial, against the account email and its verified email aliases), user_login and display_name (partial), phone (every current number in LH Phone Numbers; partial match against digits only, tolerant of spacing/formatting, stored values are E.164), first_name/last_name (partial), known_as (partial, against the stored nickname; the Known as first name a member goes by, while first_name and last_name hold the legal name), gender (exact match, one of: Male, Female, Organisation, Robot – case-sensitive, no other values are ever stored), country/state_province/town/street_address (partial), postcode (exact), and birthdate_before/birthdate_after (single date bounds, not arrays, forming an inclusive range). Every other field parameter accepts an array of values OR-ed together within that field. Any array parameter, id included, also accepts a single value, treated as a one-item array. match_mode controls whether the fields combine with AND (default) or OR across each other. Page with limit and offset. Each result includes the user’s login and their roles on the current site. Results are always restricted to users with an account on the current site. Other active plugins can add search parameters and result fields; the input and output schemas list them. Requires promote_users. Pass site_id to act on another site you belong to.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
id |
array of integer | No | Exact user IDs; a single ID is accepted too. Always a restriction on top of the other fields, whatever match_mode is. |
|
phone |
array of string | No | Phone numbers, matched by digits only against every current number in LH Phone Numbers, so spacing and a leading 0 do not matter. | |
email |
array of string | No | Partial matches on the account email and on its verified email aliases (LH User Identity). Unverified aliases are not matched. | |
user_login |
array of string | No | Partial matches on the username. | |
first_name |
array of string | No | Partial matches on first name. | |
last_name |
array of string | No | Partial matches on last name. | |
known_as |
array of string | No | Partial matches on the Known as first name (stored in nickname). | |
display_name |
array of string | No | Partial matches on display name. | |
gender |
array of string | No | Exact gender values, case-sensitive. | |
country |
array of string | No | Partial matches on country. | |
state_province |
array of string | No | Partial matches on state or province. | |
town |
array of string | No | Partial matches on town. | |
postcode |
array of string | No | Exact postcodes. | |
street_address |
array of string | No | Partial matches on street address. | |
birthdate_before |
string | No | Born on or before this date, Y-m-d. A single date, not an array. | |
birthdate_after |
string | No | Born on or after this date, Y-m-d. A single date, not an array. | |
match_mode |
string | No | "all" |
all (the default) requires every field given to match; any requires at least one. One of: all, any. |
limit |
integer | No | 20 |
Users to return, 1 to 100. Default 20. |
offset |
integer | No | 0 |
Users to skip, for paging. Default 0. |
is_member |
boolean | No | Membership of this site (LH Membership): true for members of any member type, false for users who are not members. A hard restriction whatever match_mode is. |
|
member_type |
array of string | No | LH Membership member type slugs, OR-ed: members of any of these types; a single slug is accepted too. A hard restriction whatever match_mode is. An unknown slug returns an error listing the member types on this site. |
|
site_id |
integer | No | Optional. ID of another site in the network to act on; list-my-sites gives the sites you belong to. Permissions are checked on that site. Omit for this site. | |
run_without_site_plugins |
boolean | No | Optional, with site_id. Run the call through this connector even when that site has plugins of its own that cannot be loaded for it. Without this, such a write is refused if it cannot be run on that site itself. |
Set User Roles
Adds and removes roles for one user on the current site. Only roles the caller could assign in wp-admin are accepted, and never a privileged role: one whose capabilities include promote_users, edit_users, manage_options or install_plugins (such as administrator). A user who already holds a privileged role, a super admin and the calling account are refused, as is a user with no account on the current site (use create-or-fill-user to add one). A change that would leave the user with no role is refused. Every role is checked before anything is written, so one refused role changes nothing. Roles already held (in add) or not held (in remove) are reported and left alone, so repeating a call is safe. dry_run defaults to true: set it to false to write. Returns roles before and after. Requires promote_users, plus promote_user on the target user. Pass site_id to act on another site you belong to.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
user_id |
integer | Yes | The user whose roles on the current site change. | |
add |
array of string | No | Role slugs to add, e.g. author. | |
remove |
array of string | No | Role slugs to remove. | |
dry_run |
boolean | No | true |
When true (the default) nothing is written; the result reports what would happen. |
task_id |
integer | No | Optional. The lh-tasks task this call is working on. Pass with claim_token: the call is refused unless you hold that claim, and a successful call renews it. |
|
claim_token |
string | No | Optional. The claim_token from claim-next-task for task_id. Required when task_id is given. |
|
site_id |
integer | No | Optional. ID of another site in the network to act on; list-my-sites gives the sites you belong to. Permissions are checked on that site. Omit for this site. | |
run_without_site_plugins |
boolean | No | Optional, with site_id. Run the call through this connector even when that site has plugins of its own that cannot be loaded for it. Without this, such a write is refused if it cannot be run on that site itself. |
Sync Display Name
Sets a user’s display name to a combination of their nickname, first and last name, as the WordPress profile screen offers. display_name_from picks the combination: nickname, first_name, last_name, first_last, last_first or known_as_last (the Known as first name, or the legal first name when there is none, then the legal last name, e.g. “Tezzuh Jiang”; the usual choice for members). It is built from the user’s stored names, never free text, so the display name always matches them; fill a missing name first with create-or-fill-user. A combination whose names are empty is refused, and the error lists those available. The display name is shown across the whole network, so with promote_users the user must have an account on the current site and must never have claimed their account: anyone holding a role other than unclaimed on any site is refused, as are super admins. Your own account is always allowed, and install_plugins may change any user. A display name that already equals the choice is left alone, so repeating a call is safe. dry_run defaults to true: set it to false to write. Each change is recorded on the audit trail of the member, kept forever. To change names and the display name together, use update-user-profile with display_name_from. Returns the display name before and after, every available combination and which ones the old display name matched. Requires promote_users, or install_plugins for any user. Pass site_id to act on another site you belong to.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
user_id |
integer | Yes | The user whose display name is set. | |
display_name_from |
string | Yes | Which combination to use: nickname, first_name, last_name, first_last (“First Last”), last_first (“Last First”) or known_as_last (“KnownAs Last”, falling back to the legal first name). One of: nickname, first_name, last_name, first_last, last_first, known_as_last. |
|
dry_run |
boolean | No | true |
When true (the default) nothing is written; the result reports what would happen. |
task_id |
integer | No | Optional. The lh-tasks task this call is working on. Pass with claim_token: the call is refused unless you hold that claim, and a successful call renews it. |
|
claim_token |
string | No | Optional. The claim_token from claim-next-task for task_id. Required when task_id is given. |
|
site_id |
integer | No | Optional. ID of another site in the network to act on; list-my-sites gives the sites you belong to. Permissions are checked on that site. Omit for this site. | |
run_without_site_plugins |
boolean | No | Optional, with site_id. Run the call through this connector even when that site has plugins of its own that cannot be loaded for it. Without this, such a write is refused if it cannot be run on that site itself. |
Update User Profile
Changes profile fields for one user in two calls, a preview with a confirm_token then the apply, giving each value before and after. The fields are first_name and last_name (the legal name), known_as, phone, secondary_phone, gender, birthdate, street_address, town and postcode, the ones search-users returns; email, login, password and roles have their own flows. display_name_from also sets the display name, built from the names as they will be after the change (nickname, first_name, last_name, first_last, last_first or known_as_last, the usual choice for members), never free text; fields may then be empty to change only the display name. Unlike create-or-fill-user it overwrites what is stored. Call first without confirm_token: nothing changes, and the result lists each field’s value before and after, fields already holding that value, warnings and a token valid for about 10 minutes. Show the changes to the user, then call again with the same user_id, fields and display_name_from plus confirm_token; the token works once and is refused if anything changed in between. Every value is validated before anything is written, so one invalid value changes nothing: phone numbers must parse (stored as E.164), birthdate must be a real past date as Y-m-d, gender one of the listed values, and known_as a single first name. An empty value clears known_as (the nickname goes back to the legal first name), the phones, birthdate and the address parts; names and gender cannot be cleared. Without display_name_from, a changed known_as moves a display name built from it and a changed legal name leaves it alone. Each apply is recorded on the member’s audit trail, kept forever, with the old and new values, reason as its note and the task when task_id is given. The member is not notified. Profile fields are shared across the network, so with promote_users the user must have an account on the current site and must never have claimed it: anyone holding a role other than unclaimed on any site is refused, as are super admins. Your own account is always allowed, and install_plugins may change any user. Requires promote_users, or install_plugins for any user. Pass site_id to act on another site you belong to.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
user_id |
integer | Yes | The user whose profile changes. | |
fields |
object | No | The fields to change and their new values. Leave out any field that is not changing. May be left out when display_name_from is given. |
|
display_name_from |
string | No | Optional. Also set the display name to this combination of the names as they will be after the change: nickname, first_name, last_name, first_last, last_first or known_as_last (the Known as first name, or the legal first name when there is none, then the legal last name; the usual choice for members). One of: nickname, first_name, last_name, first_last, last_first, known_as_last. |
|
reason |
string | No | Optional. Why the change is made, e.g. “Unit and street number were swapped on the application”. Recorded as the audit trail note. Send it with the confirming call; one given with the preview is used if the confirming call has none. | |
confirm_token |
string | No | Optional. The confirm_token from a preview of this same change. Omit to preview; pass to apply. |
|
task_id |
integer | No | Optional. The lh-tasks task this call is working on. Pass with claim_token: the call is refused unless you hold that claim, and a successful call renews it. |
|
claim_token |
string | No | Optional. The claim_token from claim-next-task for task_id. Required when task_id is given. |
|
site_id |
integer | No | Optional. ID of another site in the network to act on; list-my-sites gives the sites you belong to. Permissions are checked on that site. Omit for this site. | |
run_without_site_plugins |
boolean | No | Optional, with site_id. Run the call through this connector even when that site has plugins of its own that cannot be loaded for it. Without this, such a write is refused if it cannot be run on that site itself. |

